using System;
using Actions;
using UnityEngine;

namespace Visuals
{
    public class ShootCursorUi : MonoBehaviour
    {
        [SerializeField] private TargetSelector targetSelector;

        private SpriteRenderer _spriteRenderer;


        private void Awake()
        {
            _spriteRenderer = GetComponent<SpriteRenderer>();
        }

        private void Update()
        {
            if (!targetSelector.CurrentTarget)
            {
                _spriteRenderer.enabled = false;
                return;
            }
            
            _spriteRenderer.enabled = true;
            transform.position = targetSelector.CurrentTarget.transform.position;
        }
    }
}
